package com.xysd.express.util.http;


import org.xutils.http.HttpMethod;

import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/9/27 0027.
 */

public class HttpUtil {


    /**
     * 获取企业；列表
     * @param PageNo 页码
     * @param PageSize 每页条数
     * @param callBack
     */
    public static void getCompanyList(int PageNo,int PageSize,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("PageNo",PageNo);
        map.put("PageSize",PageSize);
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.GETCOMPANYLIST,map,callBack);
    }

    /**
     * 获取企业；列表
     * @param PageNo 页码
     * @param PageSize 每页条数
     * @param EnabledExpressage 是否有快递业务
     * @param callBack
     */
    public static void getCompanyListExpressage(int PageNo,int PageSize,boolean EnabledExpressage,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("PageNo",PageNo);
        map.put("PageSize",PageSize);
        map.put("EnabledExpressage",EnabledExpressage);
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.GETCOMPANYLIST,map,callBack);
    }
    /**
     * 获取企业；列表
     * @param PageNo 页码
     * @param PageSize 每页条数
     * @param EnabledLogistics 是否有快递业务
     * @param callBack
     */
    public static void getCompanyListLogistics(int PageNo,int PageSize,boolean EnabledLogistics,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("PageNo",PageNo);
        map.put("PageSize",PageSize);
        map.put("EnabledLogistics",EnabledLogistics);
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.GETCOMPANYLIST,map,callBack);
    }

    /**
     * 获取企业详情
     * @param Id 企业id
     * @param callBack
     */
    public static void getCompanyDetails(int Id,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("Id",Id);
        HttpRequestUtil.send(HttpMethod.GET,ConstantParser.GETCOMPANYDETAILS,map,callBack);
    }


    /**
     * 获取注册验证码
     * @param Mobile
     * @param callBack
     */
    public static void getVertifyCodeRegister(String Mobile,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("Mobile",Mobile);
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.GETVERTIFYCODEREGISTER,map,callBack);
    }

    /**
     * 获取重置密码验证码
     * @param Mobile
     * @param callBack
     */
    public static void getVertifyCodeResetPwd(String Mobile,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("Mobile",Mobile);
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.GETVERTIFYCODRESETPWD,map,callBack);
    }


    /**
     * 重置密码
     * @param Mobile
     * @param LoginPwd
     * @param VerifyCode
     * @param callBack
     */
    public static void resetPwd(String Mobile,String LoginPwd,String VerifyCode,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("Mobile",Mobile);
        map.put("LoginPwd",LoginPwd);
        map.put("VerifyCode",VerifyCode);
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.RESETPWD,map,callBack);
    }


    /**
     * 注册
     * @param Mobile
     * @param LoginPwd
     * @param VerifyCode
     * @param callBack
     */
    public static void register(String Mobile,String LoginPwd,String VerifyCode,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("Mobile",Mobile);
        map.put("LoginPwd",LoginPwd);
        map.put("VerifyCode",VerifyCode);
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.REGISTER,map,callBack);
    }


    /**
     * 登录
     * @param Account
     * @param Pwd
     * @param callBack
     */
    public static void login(String Account,String Pwd,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("Account",Account);
        map.put("Pwd",Pwd);
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.LOGIN,map,callBack);
    }


    /**
     * 首页
     * @param callBack
     */
    public static void getHomeData(HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        HttpRequestUtil.send(HttpMethod.GET,ConstantParser.GETHOMEDATA,map,callBack);
    }

    /**
     * 获取车辆信息
     * @param callBack
     */
    public static void getCarInfo(HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        HttpRequestUtil.send(HttpMethod.GET,ConstantParser.GETCARINFO,map,callBack);
    }


    /**
     * 发布物流订单
     * @param CompanyId 物流公司id
     * @param VehicleTypeId 车型id
     * @param CargoName 货物名称
     * @param CargoWeight 重量
     * @param CargoPrice 价值
     * @param ShipAddress 发货地址
     * @param ShipAddressDetail 发货详细地址
     * @param ShipperContactName 发货姓名
     * @param ShipperMobile 发货电话
     * @param ReceiveAddress 收货地址
     * @param ReceiveAddressDetail 收货详细地址
     * @param ReceiverContactName 收货姓名
     * @param ReceiverMobile 收货电话
     * @param Transportime 取件时间
//     * @param TotalDistance 总里程
//     * @param FuturePrice 预估价
     * @param Remark 备注
     * @param callBack
     */
    public static void publishLogistics(String CompanyId,String VehicleTypeId,String CargoName,
                                        String CargoWeight,String CargoPrice,String ShipAddress,
                                        String ShipAddressDetail,String ShipperContactName,String ShipperMobile,
                                        String ReceiveAddress,String ReceiveAddressDetail,String ReceiverContactName,
                                        String ReceiverMobile,String Transportime,String Remark,
                                        String ShipperLat,String ShipperLng,String ReceiverLat,String ReceiverLng,
//                                        String JourneyDistance,
                                        HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("CompanyId",CompanyId);
        map.put("VehicleTypeId",VehicleTypeId);
        map.put("CargoName",CargoName);
        map.put("CargoWeight",CargoWeight);
        map.put("CargoPrice",CargoPrice);
        map.put("ShipAddress",ShipAddress);
        map.put("ShipAddressDetail",ShipAddressDetail);
        map.put("ShipperContactName",ShipperContactName);
        map.put("ShipperMobile",ShipperMobile);
        map.put("ReceiveAddress",ReceiveAddress);
        map.put("ReceiveAddressDetail",ReceiveAddressDetail);
        map.put("ReceiverContactName",ReceiverContactName);
        map.put("ReceiverMobile",ReceiverMobile);
        map.put("Transportime",Transportime);
//        map.put("TotalDistance",TotalDistance);
//        map.put("FuturePrice",FuturePrice);
        map.put("Remark",Remark);
        map.put("ShipperLat",ShipperLat);
        map.put("ShipperLng",ShipperLng);
        map.put("ReceiverLat",ReceiverLat);
        map.put("ReceiverLng",ReceiverLng);
//        map.put("JourneyDistance",JourneyDistance);
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.PUBLISHLOGISTICS,map,callBack);
    }


    /**
     * 获取订单列表
     * @param PageNo 页码
     * @param PageSize 每页显示条数
     * @param OrderStatus 订单状态 1待付款 2待服务 3服务中 4已完成 5已关闭
     * @param callBack
     */
    public static void getOrderList(int PageNo,int PageSize,int OrderStatus,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("PageNo",PageNo);
        map.put("PageSize",PageSize);
        map.put("OrderStatus",OrderStatus);
        HttpRequestUtil.send(HttpMethod.POST    ,ConstantParser.GETORDERLIST,map,callBack);
    }

    /**
     * 获取快递banner
     * @param callBack
     */
    public static void getExpressageBanner(HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        HttpRequestUtil.send(HttpMethod.GET,ConstantParser.GETEXPRESSAGEBANNER,map,callBack);
    }


    /**
     * 获取快递物品类型
     * @param callBack
     */
    public static void getCargoType(HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        HttpRequestUtil.send(HttpMethod.GET,ConstantParser.GETCARGOTYPE,map,callBack);
    }


    /**
     *
     * @param CompanyId 企业id
     * @param DeliveryAddress 取货地址
     * @param DeliveryAddressDetail 取货地址详细
     * @param ShipperContactName 发货人姓名
     * @param ShipperMobile 发货人手机号
     * @param ValuableType 快递类型
     * @param ValuableName 物品名称
     * @param ValuableWeight 物品重量(kg)
     * @param PickUpTime 取货时间
     * @param Remark 备注
     * @param callBack
     */
    public static void publishExpressage(String CompanyId,String DeliveryAddress,String DeliveryAddressDetail,
                                         String ShipperContactName,String ShipperMobile,int ValuableType,
                                         String ValuableName,String ValuableWeight,String PickUpTime,
                                         String Remark,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("CompanyId",CompanyId);
        map.put("DeliveryAddress",DeliveryAddress);
        map.put("DeliveryAddressDetail",DeliveryAddressDetail);
        map.put("ShipperContactName",ShipperContactName);
        map.put("ShipperMobile",ShipperMobile);
        map.put("ValuableType",ValuableType);
        map.put("ValuableName",ValuableName);
        map.put("ValuableWeight",ValuableWeight);
        map.put("PickUpTime",PickUpTime);
        map.put("Remark",Remark);
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.PUBLISHEXPRESSAGE,map,callBack);
    }

    /**
     * 获取订单详情
     * @param id
     * @param callBack
     */
    public static void getOrderDetails(long id,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("Id",id);
        HttpRequestUtil.send(HttpMethod.GET,ConstantParser.GETORDERDETAILS,map,callBack);
    }


    /**
     * 获取用户信息
     * @param callBack
     */
    public static void getUserInfo(HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        HttpRequestUtil.send(HttpMethod.GET,ConstantParser.GETUSERINFO,map,callBack);
    }


    /**
     * 修改用户资料
     * @param NickName
     * @param AvatarPath
     * @param Sex 0未公开 1男 2 女
     * @param Industry
     * @param callBack
     */
    public static void editUserInfo(String NickName,String AvatarPath,String Sex,String Industry,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("NickName",NickName);
        map.put("AvatarPath",AvatarPath);
        map.put("Sex",Sex);
        map.put("Industry",Industry);
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.EDITUSERINFO,map,callBack);
    }


    /**
     * 上传图片
     * @param files
     * @param callBack
     */
    public static void uploadImg(List<File> files, HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        for (int i = 0; i < files.size(); i++) {
            map.put("image" + i , files.get(i));
        }
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.UPLOADIMG,map,callBack);
    }


    /**
     * 获取验证码（绑定手机号）
     * @param Mobile
     * @param callBack
     */
    public static void getVertifyCodeBind(String Mobile,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("Mobile",Mobile);
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.GETVERTIFYCODEBIND,map,callBack);
    }


    /**
     * 绑定手机号
     * @param Mobile
     * @param VerifyCode
     * @param callBack
     */
    public static void bindMobile(String Mobile,String VerifyCode,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("Mobile",Mobile);
        map.put("VerifyCode",VerifyCode);
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.BINDMOBILE,map,callBack);
    }


    /**
     * 设置支付密码
     * @param PayPwd
     * @param VerifyCode
     * @param callBack
     */
    public static void setPayPwd(String PayPwd,String VerifyCode,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("PayPwd",PayPwd);
        map.put("VerifyCode",VerifyCode);
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.SETPAYPWD,map,callBack);
    }

    /**
     * 获取设置支付密码验证码
     * @param Mobile
     * @param callBack
     */
    public static void getVertifyCodeSetPaypwd(String Mobile,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("Mobile",Mobile);
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.GETVERTIFYCODESETPAYPWD,map,callBack);
    }


    /**
     * 获取资金账户明细
     * @param callBack
     */
    public static void getAccountDetails(int PageNo,int PageSize, HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("PageNo",PageNo);
        map.put("PageSize",PageSize);
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.GETACCOUNTDETAILS,map,callBack);
    }


    /**
     * 认证
     * @param RealName
     * @param IDCardNumber
     * @param IDCardFrontUrl
     * @param IDCardReverseUrl
     * @param IDCardHandheldUrl
     * @param callBack
     */
    public static void identification(String RealName,String IDCardNumber,String IDCardFrontUrl,
                                      String IDCardReverseUrl,String IDCardHandheldUrl,HttpCallBack callBack){
        Map<String, Object> map = new HashMap<>();
        map.put("RealName",RealName);
        map.put("IDCardNumber",IDCardNumber);
        map.put("IDCardFrontUrl",IDCardFrontUrl);
        map.put("IDCardReverseUrl",IDCardReverseUrl);
        map.put("IDCardHandheldUrl",IDCardHandheldUrl);
        HttpRequestUtil.send(HttpMethod.POST,ConstantParser.IDENTIFICATION,map,callBack);
    }






}
